<template>
  <el-dialog v-model="visible" title="提示" width="30%">
    <span>是否要删除该活动??</span>
    <template #footer="{ row }">
      <span class="dialog-footer">
        <el-button @click="cancel">取消</el-button>
        <el-button type="primary" @click="del()">确定</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import { ref } from "vue";
import * as http from "@/request/api";
import EventBus from "@/utils";
const props = withDefaults(
  defineProps<{
    visible: boolean;
    delId: number;
    delApi: (id: number) => RpI<number>;
  }>(),
  {
    visible: false,
  }
);

// 声明emit
const emit = defineEmits<{
  (event: "close"): void;
}>();
const resapi = props.delApi;
// 关闭方法
function cancel() {
  emit("close");
}
async function del() {
  console.log(props.delId);
  await resapi(props.delId);
  cancel();
  EventBus.emit("isEdit", {});
}
</script>

<style></style>
